home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr11 / powerb5.zip / P5SPR001.TIP < prev    next >
Text File  |  1993-06-01  |  2KB  |  41 lines

  1. File-saving 1-2-3 macros present a problem: When you write
  2. the macro, you don't know whether the user will be given a
  3. `Cancel or Replace' option. For instance, the macro
  4. statement `/fsWIDGET\X' will save the current worksheet
  5. under the name WIDGET--if WIDGET.WK1 is not already in
  6. existence. But when the macro is used to save the file a
  7. second time, 1-2-3 will ask the user whether the current
  8. version should be replaced.
  9.  
  10. There is a solution: With the help of the {OPEN} and {CLOSE}
  11. macro commands, you can ensure the existence of a file to be
  12. overwritten by creating one automatically. This two-line
  13. macro demonstrates the technique: {OPEN
  14. "WIDGET.WK1",W}{CLOSE} /fsWIDGET\Xr
  15.  
  16. The {OPEN} command tells the program to open a file named
  17. WIDGET.WK1 for output. {CLOSE} then closes the file
  18. unchanged. If the file doesn't already exist, these two
  19. commands create it--empty and ready to be overwritten. The
  20. next line instructs 1-2-3 to save the worksheet file,
  21. replacing the file already on the disk.
  22.  
  23. This technique can be used whenever a macro uses a command
  24. that writes to disk, such as File Save, File eXtract, and
  25. Print File.
  26.  
  27. James R. Knoblock
  28. Bridgeport, West Virginia
  29.  
  30. Editor's Note: For another technique that accomplishes the
  31. same function even more simply, see the tip "Unconditional
  32. Save Redux" (also on this PowerBase *.* Volume 5 menu).
  33.  
  34.  
  35. Title: Unconditional Save for 1-2-3
  36. Category: SPR
  37. Issue Date: February, 1992
  38. Editor: Brett Glass
  39. Supplementary Files: None
  40. Filename: P5SPR001.TIP
  41.